<?php
// +----------------------------------------------------------------------
namespace addons\shopro\controller\goodsnc;
// +----------------------------------------------------------------------
use addons\shopro\controller\Base;
use addons\shopro\model\Richtext;
use addons\shopro\model\User;
use app\admin\model\shopro\goods\NcGoods;

class Index extends Base{
    protected $noNeedLogin = ['index'];
    protected $noNeedRight = '*';

    public function _initialize()
    {
        return parent::_initialize();
    }
    public function index(){
        $config = json_decode(\addons\shopro\model\Config::get(['name' =>'nc']),true);
        $config_info['area']   = $config['title'];//占地面积
        $config_info['image']  = $config['image'];//首页背景图
        $config_info['goods_poster_bg'] = $config['goods_poster_bg'];//我得农场背景图
        $config_info['user_num']        = User::count();//用户
        $article        = Richtext::order('updatetime desc')->field('id,title')->select();//新闻公告
        $data['config'] = $config_info;
        $data['articl'] = $article;
        for ($i=0;$i<=i;$i++){
            $data['nc_goods'][$i] = NcGoods::where(['is_hot'=>1,'type'=>$i+1])->field('id,title,shou_price,image,day_earnings')->select();
        }
        
        $this->success('ok',$data);
    }
}